Ext.define('cp.view.ui.LoginForm',{
    alias: 'widget.login_form',
    extend: 'Ext.form.Panel',
   
    bodyPadding: '5px 5px 5px 5px', 
    bodyStyle: 'border: none',
    fieldDefaults: {
        labelWidth: 65,
        labelAlign: 'top'
    },
   
    initComponent: function(){
      
      
      
      
       this.items = [
            { xtype: 'textfield', fieldLabel: 'Usuario', name: 'usuario', minLength: 8, allowBlank: false  },
            { xtype: 'textfield', inputType: 'password', fieldLabel: 'Clave', name: 'clave', minLength: 8, allowBlank: false },
        ];
        
        
        
        this.callParent(arguments);
    },
    submitForm: function(){
        this.getForm().submit({
            url: 'bin/session/login.php',
            method: 'POST',
            success: function(form,action){
                window.location = action.result.pagina;
            },
            failure: function(form, action){
                Ext.create('cp.view.ui.AlertErr',{mensaje:action.result.msg}).showDialog();
            }
        });         
    }
});